package com.epoint.flinkdemo.source;

import org.apache.flink.api.common.functions.FlatMapFunction;
import org.apache.flink.api.java.tuple.Tuple2;
import org.apache.flink.util.Collector;

public class WordCountFlat implements FlatMapFunction<String, Tuple2<String, Integer>>
{
    @Override
    public void flatMap(String s, Collector<Tuple2<String, Integer>> collector) throws Exception {
        String[] fields = s.split(",");
        for (String field : fields) {
            collector.collect(new Tuple2<>(field, 1));
        }
    }
}
